<?php

namespace App\Models\Admin;

use Illuminate\Database\Eloquent\Model;

class Group extends Model
{
    protected $table = 'admin_groups';
    
    /**
     * [roles 角色组和角色]
     * @return [type] [description]
     */
    public function roles()
    {
        return $this->belongsToMany(Role::class, 'admin_group_role', 'group_id', 'role_id');
    }

    /**
     * [users 角色组和用户]
     * @return [type] [description]
     */
    public function users()
    {
        return $this->belongsToMany(AdminUser::class, 'admin_group_user', 'group_id', 'user_id');
    }
}
